<%--
  Created by IntelliJ IDEA.
  User: ASUS
  Date: 2021/5/2
  Time: 15:34
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>登录</title>

    <link rel="stylesheet" href="/boot/plugins1/layui-v2.6.5/layui/css/layui.css">
    <link rel="stylesheet" href="/boot/plugins1/bootstrap/css/bootstrap.min.css">

    <link href="/boot/css/bootstrap.css" rel="stylesheet">
    <link href="/boot/plugins/revolution/css/settings.css" rel="stylesheet" type="text/css"><!-- REVOLUTION SETTINGS STYLES -->
    <link href="/boot/plugins/revolution/css/layers.css" rel="stylesheet" type="text/css"><!-- REVOLUTION LAYERS STYLES -->
    <link href="/boot/plugins/revolution/css/navigation.css" rel="stylesheet" type="text/css"><!-- REVOLUTION NAVIGATION STYLES -->
    <link href="/boot/css/style.css" rel="stylesheet">
    <link href="/boot/css/responsive.css" rel="stylesheet">
    <link rel="shortcut icon" href="/boot/images/favicon.png" type="image/x-icon">
    <link rel="icon" href="/boot/images/favicon.png" type="image/x-icon">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
</head>
<body>
<div>
    <jsp:include page="../nav.jsp" flush="true"></jsp:include>
        <%--登录--%>
            <form class="form-horizontal" role="form" id="register_from" method="post">
                <div style="margin-left: 200px;margin-bottom:30px;font-size: 20px">记得先登录哦！</div>
                <div class="form-group has-feedback">
                    <label for="uname" class="col-sm-2 control-label">用户名</label>
                    <div class="col-md-6">
                        <input type="text" class="form-control" id="uname" name="uname" placeholder="请输入用户名"><span class="cc1"></span><br>
                        <span class="glyphicon glyphicon-user form-control-feedback"></span>
                    </div>
                </div>
                <div class="form-group has-feedback">
                    <label for="pwd" class="col-sm-2 control-label">密码</label>
                    <div class="col-md-6">
                        <input type="password" class="form-control" id="pwd" name="pwd" placeholder="请输入密码"><span class="cc1"></span><br>
                        <span class="glyphicon glyphicon-lock form-control-feedback"></span>
                    </div>
                    <a href="/boot/user/email">邮箱登录</a>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <div class="checkbox">
                            <label>
                                <input type="checkbox">请记住我
                            </label>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="button" class="btn btn-default" id="register_btn">登录</button>
                    </div>
                </div>
            </form>
        </header>

        <script src="/boot/plugins1/layui-v2.6.5/layui/layui.js"></script>
        <script src="/boot/plugins1/jquery/jquery.min.js"></script>
        <script>

            function zz(){
                window.location = "/boot/registers/register"
            }
            $(function(){
                $("#register_btn").click(function(){
                    $(".cc1").html("");
                    let value = $("#register_from").serialize();
                    $.post('/boot/user/reg',value,function (data){
                        console.log(data);
                        if(data.code=="500")
                        {
                            // alert("数据登录失败");
                            let x = data.data;
                            console.log(x);
                             for(let k in x)
                             {
                                 let uname_input =$("#"+k).next().html("<font color='red'>"+x[k]+"</font>");
                             }
                        }

                        if(data.code=="200")
                        {
                            // alert("登录成功");
                            layui.use('layer', function(){
                                var layer = layui.layer;
                                layer.msg('登录成功',{icon:6});
                            });
                            window.location="/boot/user/index"
                        }
                        if(data.code=="401")
                        {
                            // alert("密码错误，请重新输入");
                            layui.use('layer', function(){
                                var layer = layui.layer;
                                layer.msg('密码错误，请重新输入',{icon:5});
                            });

                        }
                        if(data.code=="402")
                        {
                            // alert("用户错误，请重新输入");
                            layui.use('layer', function(){
                                var layer = layui.layer;
                                layer.msg('用户错误，请重新输入',{icon:5});
                            });
                        }
                    });
                });
            })
        </script>

        <script src="/boot/plugins1/bootstrap/js/bootstrap.min.js"></script>

        <script src="/boot/js/jquery.js"></script>
        <script src="/boot/js/bootstrap.min.js"></script>

        <script src="/boot/plugins/revolution/js/jquery.themepunch.revolution.min.js"></script>
        <script src="/boot/plugins/revolution/js/jquery.themepunch.tools.min.js"></script>
        <script src="/boot/plugins/revolution/js/extensions/revolution.extension.actions.min.js"></script>
        <script src="/boot/plugins/revolution/js/extensions/revolution.extension.carousel.min.js"></script>
        <script src="/boot/plugins/revolution/js/extensions/revolution.extension.kenburn.min.js"></script>
        <script src="/boot/plugins/revolution/js/extensions/revolution.extension.layeranimation.min.js"></script>
        <script src="/boot/plugins/revolution/js/extensions/revolution.extension.migration.min.js"></script>
        <script src="/boot/plugins/revolution/js/extensions/revolution.extension.navigation.min.js"></script>
        <script src="/boot/plugins/revolution/js/extensions/revolution.extension.parallax.min.js"></script>
        <script src="/boot/plugins/revolution/js/extensions/revolution.extension.slideanims.min.js"></script>
        <script src="/boot/plugins/revolution/js/extensions/revolution.extension.video.min.js"></script>
        <script src="/boot/js/main-slider-script.js"></script>

        <script src="/boot/js/jquery-ui.js"></script>
        <script src="/boot/js/jquery.fancybox.pack.js"></script>
        <script src="/boot/js/jquery.fancybox-media.js"></script>
        <script src="/boot/js/owl.js"></script>
        <script src="/boot/js/appear.js"></script>
        <script src="/boot/js/wow.js"></script>
        <script src="/boot/js/main-slider-script.js"></script>
        <script src="/boot/js/script.js"></script>

    </div>

</body>
</html>
